home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / crystal / cvinit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-01-12  |  864 b   |  42 lines

  1. /*    cvinit.c
  2.  *        initialization called the first time (taken care of by the
  3.  *        makefile.
  4.  ************************************************************************/
  5.  
  6. #include    <stdio.h>
  7. #include    <fcntl.h>
  8. #include    "cvmisc.h"
  9. #include    "cvinit.h"
  10.  
  11. extern long time();
  12. extern long ptime;
  13.  
  14. cvinit(argc,argv)
  15. int argc;
  16. char *argv[];
  17. {
  18.     auto int r;
  19.     auto unsigned length;
  20.     auto long where,offset;
  21.     extern char datastart,bssstart;
  22.     if ( (r = open(path,O_RDWR|O_EXCL|O_CREAT,0700)) == EOF) {
  23.         perror(argv[0]);
  24.         exit(1);
  25.     }
  26.     fixrmsg();    /* fix up messages that are too long for C */
  27.     checkloc();    /* check the location array */
  28.     checkobj();    /* check the objects array */
  29.     saved = 1;
  30.     (void) time(&ptime);
  31.     length = &bssstart - &datastart;
  32.     if (write(r,&datastart,length) == EOF) {
  33.         perror(argv[0]);
  34.         exit(1);
  35.     }
  36.     if (close(r)) {
  37.         perror(argv[0]);
  38.         exit(1);
  39.     }
  40.     return;
  41. }
  42.